package com.example.demo.controller;

import com.example.demo.entity.*;
import com.example.demo.service.FixedInvestmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/fixedinvestment")
public class FixedInvestmentController {
    @Autowired
    FixedInvestmentService fixedInvestmentService;

    /**
     * 分区镇固定资产投资
     * @param year
     * @param month
     * @return
     * List集合（包含MinEconomicIndicators类）
     *      * {   private int month 月份;
     *      *     private double thisMonth 当月;
     *      *     private double monthOnMonth 同比;
     *      *     private double accumulate 累计;}
     */
    @GetMapping("/getAllSubDistrictTownFixedInvestment")
    @CrossOrigin
    public List<SubDistrictTownFixedInvestment> getAllSubDistrictTownFixedInvestment(@RequestParam int year, @RequestParam int month){
        return fixedInvestmentService.getAllSubDistrictTownFixedInvestment(year, month);
    }
    /**
     * 分区镇工业投资
     * @param year
     * @param month
     * @return
     */

    @GetMapping("/getAllSubDistrictTownIndustrialInvestment")
    @CrossOrigin
    public List<SubDistrictTownIndustrialInvestment> getAllSubDistrictTownIndustrialInvestment(@RequestParam int year, @RequestParam int month){
        return fixedInvestmentService.getAllSubDistrictTownIndustrialInvestment(year, month);
    }

    /**
     * 全社会固定资产投资
     * 工业投资
     * 服务业投资
     * #房地产投资
     * 基础设施项目投资
     * 新兴产业投资
     * 高新技术产业投资
     * 民间投资
     * @param year 年份（int）,indicators 指标 (String)
     * @return
     * List集合（包含MinEconomicIndicators类）
     * {   private int month 月份;
     *     private double thisMonth 当月;
     *     private double monthOnMonth 同比;
     *     private double accumulate 累计;}
     */
    @GetMapping("/getFixedInvestmentByIndicators")
    @CrossOrigin
    public List<MinFixedInvestment> getFixedInvestmentByIndicators(@RequestParam int year, @RequestParam String indicators){
        return fixedInvestmentService.getFixedInvestmentByIndicators(year,indicators);
    }
}
